Skip to content

Conversation

@olavloite
Copy link
Collaborator

Benchmark tests are failing after submitting this change.

Reverts #4236

@olavloite olavloite requested review from a team as code owners November 20, 2025 16:15
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner API. labels Nov 20, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @olavloite, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request serves to completely undo a previous change (PR #4236) that aimed to incorporate PostgreSQL error codes into SpannerException instances. The decision to revert was made due to the original feature causing benchmark tests to fail, which indicated a negative impact on performance or stability. By reverting these changes, the codebase is restored to a known stable state, ensuring the reliability and expected performance of the system.

Highlights

  • Revert Feature: This pull request fully reverts the feature that introduced PostgreSQL error codes into SpannerException objects.
  • Reason for Revert: The original change caused benchmark tests to fail, indicating a performance regression or instability, necessitating this revert.
  • SpannerException Class Changes: The SpannerException class has been modified to remove the PG_ERR_CODE_KEY constant, the statement field, the overridden getMessage() method, the getPostgreSQLErrorCode() method, and the setStatement() method.
  • Exception Factory Usage Update: Numerous internal calls across the codebase that previously used SpannerExceptionFactory.asSpannerException have been updated to use SpannerExceptionFactory.newSpannerException.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@olavloite olavloite added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 20, 2025
@olavloite
Copy link
Collaborator Author

(Do not merge yet, we can probably re-run the benchmarks based on the old commit)

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts a feature that was causing benchmark test failures. The changes correctly remove the logic for including PostgreSQL error codes in exceptions and revert the related API changes in SpannerException. However, I've noticed a few inconsistencies in the revert where asSpannerException is not replaced by newSpannerException but is instead fully qualified. I've left comments on these specific locations. Otherwise, the revert looks correct.

} catch (Throwable t) {
throw yieldError(
asSpannerException(t),
SpannerExceptionFactory.asSpannerException(t),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change seems inconsistent with the rest of the revert. Other occurrences of asSpannerException are being changed to newSpannerException, but this one is kept and fully qualified. For consistency, shouldn't this also be changed to newSpannerException(t)? The static import for newSpannerException is available.

Suggested change
SpannerExceptionFactory.asSpannerException(t),
newSpannerException(t),

NanoClock.getDefaultClock());
} catch (RetryHelperException e) {
throw asSpannerException(e.getCause());
throw SpannerExceptionFactory.asSpannerException(e.getCause());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change to fully qualify asSpannerException seems inconsistent with the overall goal of the revert, which appears to be replacing asSpannerException with newSpannerException. Other parts of this file and the PR make that replacement. For consistency, this should probably be newSpannerException(e.getCause()).

Suggested change
throw SpannerExceptionFactory.asSpannerException(e.getCause());
throw newSpannerException(e.getCause());

} catch (ExecutionException e) {
Throwable t = e.getCause();
SpannerException se = asSpannerException(t);
SpannerException se = SpannerExceptionFactory.asSpannerException(t);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to other comments, this change to fully qualify asSpannerException is inconsistent with the revert. To maintain consistency with other changes in this PR, this should probably be newSpannerException(t).

Suggested change
SpannerException se = SpannerExceptionFactory.asSpannerException(t);
SpannerException se = newSpannerException(t);

@olavloite olavloite closed this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants